\hypertarget{class_zebulon_1_1_genetic_algorithms_1_1_chromosome}{
\section{Zebulon::GeneticAlgorithms::Chromosome Class Reference}
\label{class_zebulon_1_1_genetic_algorithms_1_1_chromosome}\index{Zebulon::GeneticAlgorithms::Chromosome@{Zebulon::GeneticAlgorithms::Chromosome}}
}


Structure for representing a chromosome within a genetic algorithm.  


{\ttfamily \#include $<$chromosome.h$>$}\subsection*{Public Member Functions}
\begin{DoxyCompactItemize}
\item 
\hypertarget{class_zebulon_1_1_genetic_algorithms_1_1_chromosome_a807f5f8d8d2fe547b32fb810d05f4b1f}{
void {\bfseries SetFitness} (const double fitness)}
\label{class_zebulon_1_1_genetic_algorithms_1_1_chromosome_a807f5f8d8d2fe547b32fb810d05f4b1f}

\item 
\hypertarget{class_zebulon_1_1_genetic_algorithms_1_1_chromosome_a12d0115e9f12a0bc69aea3610878198f}{
double {\bfseries GetFitness} () const }
\label{class_zebulon_1_1_genetic_algorithms_1_1_chromosome_a12d0115e9f12a0bc69aea3610878198f}

\item 
virtual unsigned int \hyperlink{class_zebulon_1_1_genetic_algorithms_1_1_chromosome_ae28ef83838c545ae5f34a4d9b351168e}{GetLength} () const =0
\item 
virtual double \hyperlink{class_zebulon_1_1_genetic_algorithms_1_1_chromosome_a12554f1a11eb109c0552a272e8ab45c4}{ComputeCompatibility} (const \hyperlink{class_zebulon_1_1_genetic_algorithms_1_1_chromosome}{Chromosome} $\ast$chromosome) const =0
\begin{DoxyCompactList}\small\item\em Calculate the compabitibilty between the this chromosome and the argument. This is used for finding chromosomes that belong in the same species. \item\end{DoxyCompactList}\item 
virtual \hyperlink{class_zebulon_1_1_genetic_algorithms_1_1_chromosome}{Chromosome} \hyperlink{class_zebulon_1_1_genetic_algorithms_1_1_chromosome_a1157c829e46a4bc193de94957de2c717}{PerformCrossover} (const \hyperlink{class_zebulon_1_1_genetic_algorithms_1_1_chromosome}{Chromosome} $\ast$parent1, const \hyperlink{class_zebulon_1_1_genetic_algorithms_1_1_chromosome}{Chromosome} $\ast$parent2, const \hyperlink{class_zebulon_1_1_genetic_algorithms_1_1_settings_1_1_crossover}{Settings::Crossover} \&crossoverInfo) const =0
\begin{DoxyCompactList}\small\item\em Perform crossover between two parents using the crossover settings and generate an offspring chromosome. \item\end{DoxyCompactList}\item 
virtual \hyperlink{class_zebulon_1_1_genetic_algorithms_1_1_chromosome}{Chromosome} $\ast$ \hyperlink{class_zebulon_1_1_genetic_algorithms_1_1_chromosome_a529cb0b0a5c249da11e9e8cfd5647460}{Clone} () const =0
\item 
virtual bool \hyperlink{class_zebulon_1_1_genetic_algorithms_1_1_chromosome_a3e783ccb5a34eccb003b67375731826e}{Mutate} (const \hyperlink{class_zebulon_1_1_genetic_algorithms_1_1_settings_1_1_mutation}{Settings::Mutation} \&mutation)=0
\begin{DoxyCompactList}\small\item\em Apply mutation to your gene based on the rate provided. \item\end{DoxyCompactList}\item 
\hypertarget{class_zebulon_1_1_genetic_algorithms_1_1_chromosome_a55c27be2bf30604dc7241f22d0a95a0b}{
virtual int \hyperlink{class_zebulon_1_1_genetic_algorithms_1_1_chromosome_a55c27be2bf30604dc7241f22d0a95a0b}{Write} (FILE $\ast$fp) const }
\label{class_zebulon_1_1_genetic_algorithms_1_1_chromosome_a55c27be2bf30604dc7241f22d0a95a0b}

\begin{DoxyCompactList}\small\item\em Write information to a file. It is up to the developer to choose file format. \item\end{DoxyCompactList}\item 
virtual int \hyperlink{class_zebulon_1_1_genetic_algorithms_1_1_chromosome_a583c627e67decd9cf07c6dbf818483b9}{Write} (CxUtils::Packet \&packet) const 
\begin{DoxyCompactList}\small\item\em Write information within a packet structure. This is useful for developing applications requiring distribution of processing over a network. \item\end{DoxyCompactList}\item 
\hypertarget{class_zebulon_1_1_genetic_algorithms_1_1_chromosome_a74779abfec0175ac69eb4ce2e9af95b3}{
virtual int \hyperlink{class_zebulon_1_1_genetic_algorithms_1_1_chromosome_a74779abfec0175ac69eb4ce2e9af95b3}{Read} (FILE $\ast$fp)}
\label{class_zebulon_1_1_genetic_algorithms_1_1_chromosome_a74779abfec0175ac69eb4ce2e9af95b3}

\begin{DoxyCompactList}\small\item\em Read information from a file based on format chosen using the Write method. \item\end{DoxyCompactList}\item 
virtual int \hyperlink{class_zebulon_1_1_genetic_algorithms_1_1_chromosome_a9d396ec3d88f59fb2c3820a3c8a281e1}{Read} (const CxUtils::Packet \&packet)
\begin{DoxyCompactList}\small\item\em Read information within a packet structure. \item\end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{Static Public Member Functions}
\begin{DoxyCompactItemize}
\item 
\hypertarget{class_zebulon_1_1_genetic_algorithms_1_1_chromosome_a9fd0220ab5b16fcef29a5ecabfca4c78}{
static bool {\bfseries PerformCrossover} (const Gene::Vector \&parent1, const Gene::Vector \&parent2, const \hyperlink{class_zebulon_1_1_genetic_algorithms_1_1_settings_1_1_crossover}{Settings::Crossover} \&crossoverInfo, Gene::Vector \&offspring)}
\label{class_zebulon_1_1_genetic_algorithms_1_1_chromosome_a9fd0220ab5b16fcef29a5ecabfca4c78}

\end{DoxyCompactItemize}
\subsection*{Protected Attributes}
\begin{DoxyCompactItemize}
\item 
\hypertarget{class_zebulon_1_1_genetic_algorithms_1_1_chromosome_a7feefa1e593147fa3163c383c5437b8d}{
double \hyperlink{class_zebulon_1_1_genetic_algorithms_1_1_chromosome_a7feefa1e593147fa3163c383c5437b8d}{mFitness}}
\label{class_zebulon_1_1_genetic_algorithms_1_1_chromosome_a7feefa1e593147fa3163c383c5437b8d}

\begin{DoxyCompactList}\small\item\em Fitness of the chromosome \mbox{[}0,1\mbox{]}. \item\end{DoxyCompactList}\end{DoxyCompactItemize}


\subsection{Detailed Description}
Structure for representing a chromosome within a genetic algorithm. A chromosome is how solutions you want to evolve are represented withing a genetic algorithm. This interface lets developers design chromosomes that can be used within the Engine class which will perform evolution. 

\subsection{Member Function Documentation}
\hypertarget{class_zebulon_1_1_genetic_algorithms_1_1_chromosome_a529cb0b0a5c249da11e9e8cfd5647460}{
\index{Zebulon::GeneticAlgorithms::Chromosome@{Zebulon::GeneticAlgorithms::Chromosome}!Clone@{Clone}}
\index{Clone@{Clone}!Zebulon::GeneticAlgorithms::Chromosome@{Zebulon::GeneticAlgorithms::Chromosome}}
\subsubsection[{Clone}]{\setlength{\rightskip}{0pt plus 5cm}virtual {\bf Chromosome}$\ast$ Zebulon::GeneticAlgorithms::Chromosome::Clone () const\hspace{0.3cm}{\ttfamily  \mbox{[}pure virtual\mbox{]}}}}
\label{class_zebulon_1_1_genetic_algorithms_1_1_chromosome_a529cb0b0a5c249da11e9e8cfd5647460}
\begin{DoxyReturn}{Returns}
A duplicate of your gene data. 
\end{DoxyReturn}
\hypertarget{class_zebulon_1_1_genetic_algorithms_1_1_chromosome_a12554f1a11eb109c0552a272e8ab45c4}{
\index{Zebulon::GeneticAlgorithms::Chromosome@{Zebulon::GeneticAlgorithms::Chromosome}!ComputeCompatibility@{ComputeCompatibility}}
\index{ComputeCompatibility@{ComputeCompatibility}!Zebulon::GeneticAlgorithms::Chromosome@{Zebulon::GeneticAlgorithms::Chromosome}}
\subsubsection[{ComputeCompatibility}]{\setlength{\rightskip}{0pt plus 5cm}virtual double Zebulon::GeneticAlgorithms::Chromosome::ComputeCompatibility (const {\bf Chromosome} $\ast$ {\em chromosome}) const\hspace{0.3cm}{\ttfamily  \mbox{[}pure virtual\mbox{]}}}}
\label{class_zebulon_1_1_genetic_algorithms_1_1_chromosome_a12554f1a11eb109c0552a272e8ab45c4}


Calculate the compabitibilty between the this chromosome and the argument. This is used for finding chromosomes that belong in the same species. 
\begin{DoxyParams}{Parameters}
\item[{\em chromosome}]\hyperlink{class_zebulon_1_1_genetic_algorithms_1_1_chromosome}{Chromosome} to calculate compatibility with.\end{DoxyParams}
\begin{DoxyReturn}{Returns}
Compatibility with chromosome. 
\end{DoxyReturn}
\hypertarget{class_zebulon_1_1_genetic_algorithms_1_1_chromosome_ae28ef83838c545ae5f34a4d9b351168e}{
\index{Zebulon::GeneticAlgorithms::Chromosome@{Zebulon::GeneticAlgorithms::Chromosome}!GetLength@{GetLength}}
\index{GetLength@{GetLength}!Zebulon::GeneticAlgorithms::Chromosome@{Zebulon::GeneticAlgorithms::Chromosome}}
\subsubsection[{GetLength}]{\setlength{\rightskip}{0pt plus 5cm}virtual unsigned int Zebulon::GeneticAlgorithms::Chromosome::GetLength () const\hspace{0.3cm}{\ttfamily  \mbox{[}pure virtual\mbox{]}}}}
\label{class_zebulon_1_1_genetic_algorithms_1_1_chromosome_ae28ef83838c545ae5f34a4d9b351168e}
\begin{DoxyReturn}{Returns}
Length of chromosome. 
\end{DoxyReturn}
\hypertarget{class_zebulon_1_1_genetic_algorithms_1_1_chromosome_a3e783ccb5a34eccb003b67375731826e}{
\index{Zebulon::GeneticAlgorithms::Chromosome@{Zebulon::GeneticAlgorithms::Chromosome}!Mutate@{Mutate}}
\index{Mutate@{Mutate}!Zebulon::GeneticAlgorithms::Chromosome@{Zebulon::GeneticAlgorithms::Chromosome}}
\subsubsection[{Mutate}]{\setlength{\rightskip}{0pt plus 5cm}virtual bool Zebulon::GeneticAlgorithms::Chromosome::Mutate (const {\bf Settings::Mutation} \& {\em mutation})\hspace{0.3cm}{\ttfamily  \mbox{[}pure virtual\mbox{]}}}}
\label{class_zebulon_1_1_genetic_algorithms_1_1_chromosome_a3e783ccb5a34eccb003b67375731826e}


Apply mutation to your gene based on the rate provided. 
\begin{DoxyParams}{Parameters}
\item[{\em mutation}]Mutation information to use for mutation of chromosome.\end{DoxyParams}
\begin{DoxyReturn}{Returns}
True on success, otherwise false. 
\end{DoxyReturn}
\hypertarget{class_zebulon_1_1_genetic_algorithms_1_1_chromosome_a1157c829e46a4bc193de94957de2c717}{
\index{Zebulon::GeneticAlgorithms::Chromosome@{Zebulon::GeneticAlgorithms::Chromosome}!PerformCrossover@{PerformCrossover}}
\index{PerformCrossover@{PerformCrossover}!Zebulon::GeneticAlgorithms::Chromosome@{Zebulon::GeneticAlgorithms::Chromosome}}
\subsubsection[{PerformCrossover}]{\setlength{\rightskip}{0pt plus 5cm}virtual {\bf Chromosome} Zebulon::GeneticAlgorithms::Chromosome::PerformCrossover (const {\bf Chromosome} $\ast$ {\em parent1}, \/  const {\bf Chromosome} $\ast$ {\em parent2}, \/  const {\bf Settings::Crossover} \& {\em crossoverInfo}) const\hspace{0.3cm}{\ttfamily  \mbox{[}pure virtual\mbox{]}}}}
\label{class_zebulon_1_1_genetic_algorithms_1_1_chromosome_a1157c829e46a4bc193de94957de2c717}


Perform crossover between two parents using the crossover settings and generate an offspring chromosome. 
\begin{DoxyParams}{Parameters}
\item[{\em parent1}]First parent to use for crossover. \item[{\em parent2}]Second parent to use for crossover. \item[{\em crossoverInfo}]Type of crossover and settings involved.\end{DoxyParams}
\begin{DoxyReturn}{Returns}
A pointer to a newly allocated \hyperlink{class_zebulon_1_1_genetic_algorithms_1_1_chromosome}{Chromosome} which is the offspring/result of crossover between the two parents. 
\end{DoxyReturn}
\hypertarget{class_zebulon_1_1_genetic_algorithms_1_1_chromosome_a9d396ec3d88f59fb2c3820a3c8a281e1}{
\index{Zebulon::GeneticAlgorithms::Chromosome@{Zebulon::GeneticAlgorithms::Chromosome}!Read@{Read}}
\index{Read@{Read}!Zebulon::GeneticAlgorithms::Chromosome@{Zebulon::GeneticAlgorithms::Chromosome}}
\subsubsection[{Read}]{\setlength{\rightskip}{0pt plus 5cm}virtual int Zebulon::GeneticAlgorithms::Chromosome::Read (const CxUtils::Packet \& {\em packet})\hspace{0.3cm}{\ttfamily  \mbox{[}inline, virtual\mbox{]}}}}
\label{class_zebulon_1_1_genetic_algorithms_1_1_chromosome_a9d396ec3d88f59fb2c3820a3c8a281e1}


Read information within a packet structure. 
\begin{DoxyParams}{Parameters}
\item[{\em packet}]Packet buffer to de-\/serialize data from.\end{DoxyParams}
\begin{DoxyReturn}{Returns}
Number of bytes read. 
\end{DoxyReturn}
\hypertarget{class_zebulon_1_1_genetic_algorithms_1_1_chromosome_a583c627e67decd9cf07c6dbf818483b9}{
\index{Zebulon::GeneticAlgorithms::Chromosome@{Zebulon::GeneticAlgorithms::Chromosome}!Write@{Write}}
\index{Write@{Write}!Zebulon::GeneticAlgorithms::Chromosome@{Zebulon::GeneticAlgorithms::Chromosome}}
\subsubsection[{Write}]{\setlength{\rightskip}{0pt plus 5cm}virtual int Zebulon::GeneticAlgorithms::Chromosome::Write (CxUtils::Packet \& {\em packet}) const\hspace{0.3cm}{\ttfamily  \mbox{[}inline, virtual\mbox{]}}}}
\label{class_zebulon_1_1_genetic_algorithms_1_1_chromosome_a583c627e67decd9cf07c6dbf818483b9}


Write information within a packet structure. This is useful for developing applications requiring distribution of processing over a network. 
\begin{DoxyParams}{Parameters}
\item[{\em packet}]Packet buffer to serialize data to.\end{DoxyParams}
\begin{DoxyReturn}{Returns}
Number of bytes written. 
\end{DoxyReturn}


The documentation for this class was generated from the following file:\begin{DoxyCompactItemize}
\item 
C:/Users/Matt/Documents/School/Robotics/zebulon/v2/zebml/include/ga/\hyperlink{chromosome_8h}{chromosome.h}\end{DoxyCompactItemize}
